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

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

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

d = A("d")
m = B("m")
c = C("c")
e = B("e")
l = C("l")
h = B("h")
j = A("j")
k = C("k")
n = A("n")

d.q = j
m.t = e
m.z = e
m.y = n
c.x = l
c.p = l
c.y = n
e.t = h
e.z = h
e.y = d
l.x = k
l.p = c
l.y = d
h.t = e
h.y = d
h.z = m
j.q = d
k.x = l
k.p = c
k.y = j
n.q = j
assert n.q.q.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.txt = txt

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

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

d = A("d")
m = B("m")
c = C("c")
e = B("e")
l = C("l")
h = B("h")
j = A("j")
k = C("k")
n = A("n")

d.q = j
m.t = e
m.z = e
m.y = n
c.x = l
c.p = l
c.y = n
e.t = h
e.z = h
e.y = d
l.x = k
l.p = c
l.y = d
h.t = e
h.y = d
h.z = m
j.q = d
k.x = l
k.p = c
k.y = j
n.q = j
assert n.q.q.q.q.txt == "d"