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

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

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.u: A = None
        self.q: A = None
        self.v: E = None
        self.o: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: E = None
        self.v: A = None
        self.q: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: A = None
        self.t: B = None
        self.w: D = None
        self.v: B = None
        self.z: F = None
        self.u: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: A = None
        self.t: A = None
        self.s: E = None
        self.txt = txt

f = A("f")
k = B("k")
c = C("c")
l = D("l")
h = E("h")
n = F("n")
a = A("a")
e = A("e")

f.p = a
k.q = l
k.z = e
c.x = l
c.o = l
c.u = e
c.q = a
c.v = h
l.s = h
l.v = e
l.q = e
h.y = f
h.u = f
h.t = k
h.v = k
h.w = l
h.z = n
n.y = f
n.t = f
n.s = h
a.p = f
e.p = f
assert a.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.q: D = None
        self.z: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.u: A = None
        self.q: A = None
        self.v: E = None
        self.o: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: E = None
        self.v: A = None
        self.q: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: A = None
        self.t: B = None
        self.w: D = None
        self.v: B = None
        self.z: F = None
        self.u: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: A = None
        self.t: A = None
        self.s: E = None
        self.txt = txt

f = A("f")
k = B("k")
c = C("c")
l = D("l")
h = E("h")
n = F("n")
a = A("a")
e = A("e")

f.p = a
k.q = l
k.z = e
c.x = l
c.o = l
c.u = e
c.q = a
c.v = h
l.s = h
l.v = e
l.q = e
h.y = f
h.u = f
h.t = k
h.v = k
h.w = l
h.z = n
n.y = f
n.t = f
n.s = h
a.p = f
e.p = f
assert a.p.p.p.p.p.p.txt == "a"