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

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

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

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

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

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

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

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

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

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

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