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

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

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

class D:
    def __init__(self, txt: str):
        self.x: C = None
        self.w: C = None
        self.u: A = None
        self.y: A = None
        self.txt = txt

g = A("g")
d = B("d")
n = C("n")
j = D("j")
k = B("k")

g.u = d
d.s = g
d.u = j
d.t = j
d.z = n
n.o = g
n.q = g
n.v = k
n.u = d
j.x = n
j.w = n
j.u = g
j.y = g
k.s = g
k.u = j
k.t = j
k.z = n
assert j.u.u.z.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.x: C = None
        self.w: C = None
        self.u: A = None
        self.y: A = None
        self.txt = txt

g = A("g")
d = B("d")
n = C("n")
j = D("j")
k = B("k")

g.u = d
d.s = g
d.u = j
d.t = j
d.z = n
n.o = g
n.q = g
n.v = k
n.u = d
j.x = n
j.w = n
j.u = g
j.y = g
k.s = g
k.u = j
k.t = j
k.z = n
assert j.u.u.z.u.txt == "d"