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

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

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

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.z: C = None
        self.w: F = None
        self.p: E = None
        self.r: C = None
        self.x: A = None
        self.txt = txt

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

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

j = A("j")
c = B("c")
k = C("k")
e = D("e")
h = E("h")
d = F("d")

j.p = c
j.z = c
j.y = c
j.r = c
j.u = k
j.w = e
c.r = j
c.x = k
c.t = k
k.o = j
e.v = k
e.z = k
e.r = k
e.w = d
e.p = h
e.x = j
h.y = k
d.u = c
d.z = j
d.v = h
d.p = h
d.y = h
d.x = k
assert j.z.t.o.u.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.z: B = None
        self.y: B = None
        self.r: B = None
        self.u: C = None
        self.w: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.z: C = None
        self.w: F = None
        self.p: E = None
        self.r: C = None
        self.x: A = None
        self.txt = txt

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

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

j = A("j")
c = B("c")
k = C("k")
e = D("e")
h = E("h")
d = F("d")

j.p = c
j.z = c
j.y = c
j.r = c
j.u = k
j.w = e
c.r = j
c.x = k
c.t = k
k.o = j
e.v = k
e.z = k
e.r = k
e.w = d
e.p = h
e.x = j
h.y = k
d.u = c
d.z = j
d.v = h
d.p = h
d.y = h
d.x = k
assert j.z.t.o.u.txt == "k"