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

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

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

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

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

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

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

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

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

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

b.u = d
b.t = c
k.r = g
k.v = n
k.y = d
d.u = k
d.r = c
d.z = c
d.s = j
j.x = k
m.u = n
m.t = b
g.u = k
g.r = b
g.s = j
g.z = c
n.u = k
n.r = m
n.z = m
n.s = j
c.u = d
c.t = b
i.u = k
i.r = c
i.z = c
i.s = j
assert b.t.t.t.u.u.r.u.v.u.txt == "k"