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

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

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

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

a = A("a")
n = B("n")
c = C("c")
g = D("g")
l = D("l")
f = D("f")
e = B("e")
i = C("i")
j = C("j")

a.z = i
n.q = j
c.t = i
c.z = a
g.x = l
l.x = f
f.x = l
e.q = c
i.t = c
i.z = a
j.t = i
j.z = a
assert e.q.z.z.z.z.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

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

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

a = A("a")
n = B("n")
c = C("c")
g = D("g")
l = D("l")
f = D("f")
e = B("e")
i = C("i")
j = C("j")

a.z = i
n.q = j
c.t = i
c.z = a
g.x = l
l.x = f
f.x = l
e.q = c
i.t = c
i.z = a
j.t = i
j.z = a
assert e.q.z.z.z.z.t.z.txt == "a"