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

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

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

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

d = A("d")
k = B("k")
j = C("j")
g = D("g")
e = D("e")
b = B("b")
c = A("c")
n = D("n")

d.x = j
d.z = c
d.t = c
d.s = c
k.x = b
j.u = c
j.v = b
g.q = j
g.r = j
g.u = k
e.q = j
e.r = j
e.u = k
b.x = k
c.x = j
c.z = d
c.t = d
c.s = d
n.q = j
n.r = j
n.u = b
assert c.x.v.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.z: A = None
        self.t: A = None
        self.s: A = None
        self.txt = txt

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

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

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

d = A("d")
k = B("k")
j = C("j")
g = D("g")
e = D("e")
b = B("b")
c = A("c")
n = D("n")

d.x = j
d.z = c
d.t = c
d.s = c
k.x = b
j.u = c
j.v = b
g.q = j
g.r = j
g.u = k
e.q = j
e.r = j
e.u = k
b.x = k
c.x = j
c.z = d
c.t = d
c.s = d
n.q = j
n.r = j
n.u = b
assert c.x.v.x.x.txt == "b"