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

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

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

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

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

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

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

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

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

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

g.v = b
g.r = b
g.o = j
c.z = k
c.u = d
d.z = g
d.y = g
e.z = d
e.o = b
b.v = g
b.r = g
b.o = c
j.z = k
j.u = d
f.z = e
f.u = d
k.z = d
k.o = g
assert c.z.o.v.r.o.u.txt == "d"