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

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

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

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

b = A("b")
l = B("l")
k = C("k")
i = D("i")
d = B("d")
e = D("e")
f = C("f")
a = B("a")
h = A("h")
j = D("j")

b.q = k
l.t = f
l.v = b
k.z = h
i.x = e
d.t = k
d.v = b
e.x = j
f.z = h
a.t = f
a.v = b
h.q = k
j.x = e
assert e.x.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

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

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

b = A("b")
l = B("l")
k = C("k")
i = D("i")
d = B("d")
e = D("e")
f = C("f")
a = B("a")
h = A("h")
j = D("j")

b.q = k
l.t = f
l.v = b
k.z = h
i.x = e
d.t = k
d.v = b
e.x = j
f.z = h
a.t = f
a.v = b
h.q = k
j.x = e
assert e.x.x.x.x.txt == "e"