class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.r: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: A = None
        self.z: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: A = None
        self.w: B = None
        self.u: A = None
        self.txt = txt

l = A("l")
f = B("f")
g = C("g")
i = D("i")
j = E("j")
e = F("e")
b = D("b")

l.x = i
l.r = e
f.o = b
g.t = i
g.p = i
i.r = l
i.z = g
j.p = l
e.y = l
e.u = l
e.w = f
b.r = l
b.z = g
assert g.t.z.p.r.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.r: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: A = None
        self.z: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: A = None
        self.w: B = None
        self.u: A = None
        self.txt = txt

l = A("l")
f = B("f")
g = C("g")
i = D("i")
j = E("j")
e = F("e")
b = D("b")

l.x = i
l.r = e
f.o = b
g.t = i
g.p = i
i.r = l
i.z = g
j.p = l
e.y = l
e.u = l
e.w = f
b.r = l
b.z = g
assert g.t.z.p.r.txt == "l"