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

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

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

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

j = A("j")
k = B("k")
l = C("l")
f = D("f")
h = A("h")
i = C("i")

j.u = h
j.x = h
j.r = f
k.r = f
k.o = l
l.w = k
l.t = k
l.x = f
l.z = j
f.s = k
f.y = h
h.u = j
h.x = j
h.r = f
i.w = k
i.t = k
i.x = f
i.z = h
assert l.t.o.z.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.x: A = None
        self.r: D = None
        self.txt = txt

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

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

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

j = A("j")
k = B("k")
l = C("l")
f = D("f")
h = A("h")
i = C("i")

j.u = h
j.x = h
j.r = f
k.r = f
k.o = l
l.w = k
l.t = k
l.x = f
l.z = j
f.s = k
f.y = h
h.u = j
h.x = j
h.r = f
i.w = k
i.t = k
i.x = f
i.z = h
assert l.t.o.z.x.txt == "h"