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

class B:
    def __init__(self, txt: str):
        self.s: D = None
        self.u: F = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: A = None
        self.o: C = None
        self.txt = txt

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

j.x = l
d.s = c
d.u = e
l.q = e
c.t = d
f.y = l
f.p = c
f.o = d
e.t = m
e.o = l
m.x = l
assert c.t.u.t.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: D = None
        self.u: F = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: A = None
        self.o: C = None
        self.txt = txt

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

j.x = l
d.s = c
d.u = e
l.q = e
c.t = d
f.y = l
f.p = c
f.o = d
e.t = m
e.o = l
m.x = l
assert c.t.u.t.x.txt == "l"