class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.r: B = None
        self.x: B = None
        self.q: B = None
        self.txt = txt

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

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

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

l = A("l")
k = B("k")
c = C("c")
i = D("i")
h = C("h")
b = A("b")
j = A("j")
a = B("a")

l.t = a
l.r = a
l.x = a
l.q = k
k.r = i
c.x = h
c.y = h
i.t = h
i.z = h
h.x = c
h.y = c
b.t = a
b.x = a
b.r = k
b.q = k
j.t = a
j.r = a
j.x = a
j.q = k
a.r = i
assert k.r.z.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.r: B = None
        self.x: B = None
        self.q: B = None
        self.txt = txt

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

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

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

l = A("l")
k = B("k")
c = C("c")
i = D("i")
h = C("h")
b = A("b")
j = A("j")
a = B("a")

l.t = a
l.r = a
l.x = a
l.q = k
k.r = i
c.x = h
c.y = h
i.t = h
i.z = h
h.x = c
h.y = c
b.t = a
b.x = a
b.r = k
b.q = k
j.t = a
j.r = a
j.x = a
j.q = k
a.r = i
assert k.r.z.x.x.x.txt == "c"