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

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

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

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

k = A("k")
d = B("d")
n = C("n")
i = D("i")
j = C("j")
f = B("f")
b = B("b")

k.u = i
k.r = n
k.t = b
k.z = d
d.v = i
d.y = b
n.o = i
n.x = j
n.u = f
i.r = f
i.q = n
j.o = i
j.x = n
j.u = f
f.v = i
f.y = b
b.v = i
b.y = d
assert n.u.y.v.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.r: C = None
        self.t: B = None
        self.z: B = None
        self.txt = txt

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

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

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

k = A("k")
d = B("d")
n = C("n")
i = D("i")
j = C("j")
f = B("f")
b = B("b")

k.u = i
k.r = n
k.t = b
k.z = d
d.v = i
d.y = b
n.o = i
n.x = j
n.u = f
i.r = f
i.q = n
j.o = i
j.x = n
j.u = f
f.v = i
f.y = b
b.v = i
b.y = d
assert n.u.y.v.txt == "i"