class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.v: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.x: E = None
        self.p: C = None
        self.o: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: C = None
        self.w: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: A = None
        self.v: B = None
        self.y: A = None
        self.s: C = None
        self.txt = txt

a = A("a")
b = B("b")
l = C("l")
g = D("g")
e = E("e")
f = E("f")
h = E("h")
m = C("m")

a.t = g
b.x = l
b.v = a
l.r = g
l.x = e
l.p = m
l.o = b
g.y = m
g.w = l
e.x = a
e.y = a
e.v = b
e.s = m
f.x = a
f.y = a
f.v = b
f.s = l
h.x = a
h.y = a
h.v = b
h.s = m
m.r = g
m.x = e
m.p = l
m.o = b
assert h.s.o.x.x.y.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.v: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.x: E = None
        self.p: C = None
        self.o: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: C = None
        self.w: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: A = None
        self.v: B = None
        self.y: A = None
        self.s: C = None
        self.txt = txt

a = A("a")
b = B("b")
l = C("l")
g = D("g")
e = E("e")
f = E("f")
h = E("h")
m = C("m")

a.t = g
b.x = l
b.v = a
l.r = g
l.x = e
l.p = m
l.o = b
g.y = m
g.w = l
e.x = a
e.y = a
e.v = b
e.s = m
f.x = a
f.y = a
f.v = b
f.s = l
h.x = a
h.y = a
h.v = b
h.s = m
m.r = g
m.x = e
m.p = l
m.o = b
assert h.s.o.x.x.y.t.txt == "g"