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

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

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

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

b = A("b")
k = B("k")
i = C("i")
j = D("j")
g = D("g")
a = B("a")
f = A("f")
l = C("l")
c = C("c")
d = B("d")

b.z = k
k.v = g
k.u = j
i.o = c
i.q = j
i.r = k
i.v = g
j.z = k
g.z = a
a.v = g
a.u = j
f.z = d
l.o = c
l.q = j
l.v = j
l.r = k
c.o = l
c.q = g
c.v = g
c.r = a
d.v = j
d.u = j
assert i.r.u.z.u.z.v.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

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

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

b = A("b")
k = B("k")
i = C("i")
j = D("j")
g = D("g")
a = B("a")
f = A("f")
l = C("l")
c = C("c")
d = B("d")

b.z = k
k.v = g
k.u = j
i.o = c
i.q = j
i.r = k
i.v = g
j.z = k
g.z = a
a.v = g
a.u = j
f.z = d
l.o = c
l.q = j
l.v = j
l.r = k
c.o = l
c.q = g
c.v = g
c.r = a
d.v = j
d.u = j
assert i.r.u.z.u.z.v.txt == "g"