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

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

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

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

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

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

k = A("k")
m = B("m")
j = C("j")
n = D("n")
i = E("i")
e = F("e")
h = D("h")
c = C("c")

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

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

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

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

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

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

k = A("k")
m = B("m")
j = C("j")
n = D("n")
i = E("i")
e = F("e")
h = D("h")
c = C("c")

k.y = m
k.u = i
k.x = n
k.q = h
k.t = h
k.w = c
m.p = n
j.z = m
j.r = k
j.o = i
n.p = m
n.q = i
i.t = n
e.r = i
e.p = k
h.p = m
h.q = i
c.z = m
c.r = k
c.o = i
assert i.t.p.p.p.p.txt == "n"