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

class B:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

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

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

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

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

c.p = h
b.w = a
a.t = i
a.q = k
a.w = j
a.s = c
a.z = b
k.o = d
k.t = b
j.p = c
j.z = c
j.y = c
j.r = i
j.u = b
e.y = j
e.w = j
e.x = d
e.r = a
i.o = d
i.t = b
h.p = c
d.y = j
d.w = j
d.x = e
d.r = a
assert c.p.p.p.p.p.p.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

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

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

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

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

c.p = h
b.w = a
a.t = i
a.q = k
a.w = j
a.s = c
a.z = b
k.o = d
k.t = b
j.p = c
j.z = c
j.y = c
j.r = i
j.u = b
e.y = j
e.w = j
e.x = d
e.r = a
i.o = d
i.t = b
h.p = c
d.y = j
d.w = j
d.x = e
d.r = a
assert c.p.p.p.p.p.p.p.p.txt == "c"