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

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.t: C = None
        self.x: B = None
        self.p: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: C = None
        self.u: C = None
        self.w: A = None
        self.o: A = None
        self.p: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

l = A("l")
j = B("j")
h = C("h")
c = D("c")
m = E("m")
a = F("a")
d = B("d")
e = D("e")
f = A("f")

l.x = j
j.z = c
j.p = c
j.t = h
j.x = d
h.s = m
c.o = m
m.v = h
m.u = h
m.w = f
m.o = f
m.p = f
a.q = m
d.z = e
d.p = e
d.t = h
d.x = j
e.o = m
f.x = d
assert m.u.s.w.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.t: C = None
        self.x: B = None
        self.p: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: C = None
        self.u: C = None
        self.w: A = None
        self.o: A = None
        self.p: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

l = A("l")
j = B("j")
h = C("h")
c = D("c")
m = E("m")
a = F("a")
d = B("d")
e = D("e")
f = A("f")

l.x = j
j.z = c
j.p = c
j.t = h
j.x = d
h.s = m
c.o = m
m.v = h
m.u = h
m.w = f
m.o = f
m.p = f
a.q = m
d.z = e
d.p = e
d.t = h
d.x = j
e.o = m
f.x = d
assert m.u.s.w.x.txt == "d"