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

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

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

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

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

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

j = A("j")
c = B("c")
n = C("n")
f = D("f")
i = E("i")
d = F("d")

j.t = c
j.w = n
j.r = f
j.y = f
c.u = d
n.y = f
n.t = i
f.y = n
i.p = c
i.v = c
i.r = j
i.q = d
i.u = n
i.o = n
d.v = n
d.p = n
assert c.u.p.y.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.w: C = None
        self.r: D = None
        self.y: D = None
        self.txt = txt

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

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

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

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

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

j = A("j")
c = B("c")
n = C("n")
f = D("f")
i = E("i")
d = F("d")

j.t = c
j.w = n
j.r = f
j.y = f
c.u = d
n.y = f
n.t = i
f.y = n
i.p = c
i.v = c
i.r = j
i.q = d
i.u = n
i.o = n
d.v = n
d.p = n
assert c.u.p.y.y.y.y.txt == "n"