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

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

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

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

a = A("a")
k = B("k")
d = C("d")
j = D("j")
c = D("c")
f = C("f")

a.t = c
a.r = d
k.t = c
k.u = c
k.x = a
k.o = d
d.v = k
d.p = c
d.r = a
d.z = j
j.u = k
j.t = k
j.v = k
j.r = d
c.u = k
c.t = k
c.v = k
c.r = f
f.v = k
f.p = j
f.r = a
f.z = c
assert d.p.r.r.r.v.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.r: C = None
        self.txt = txt

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

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

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

a = A("a")
k = B("k")
d = C("d")
j = D("j")
c = D("c")
f = C("f")

a.t = c
a.r = d
k.t = c
k.u = c
k.x = a
k.o = d
d.v = k
d.p = c
d.r = a
d.z = j
j.u = k
j.t = k
j.v = k
j.r = d
c.u = k
c.t = k
c.v = k
c.r = f
f.v = k
f.p = j
f.r = a
f.z = c
assert d.p.r.r.r.v.txt == "k"