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

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

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

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

c = A("c")
g = B("g")
a = C("a")
j = D("j")
l = A("l")
k = C("k")

c.q = k
c.r = l
c.s = g
g.t = j
a.t = j
j.y = c
j.u = c
j.z = a
l.q = a
l.r = c
l.s = g
k.t = j
assert a.t.u.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.r: A = None
        self.s: B = None
        self.txt = txt

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

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

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

c = A("c")
g = B("g")
a = C("a")
j = D("j")
l = A("l")
k = C("k")

c.q = k
c.r = l
c.s = g
g.t = j
a.t = j
j.y = c
j.u = c
j.z = a
l.q = a
l.r = c
l.s = g
k.t = j
assert a.t.u.r.r.txt == "c"