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

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

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

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

l = A("l")
d = B("d")
m = C("m")
h = D("h")
b = C("b")
j = A("j")

l.u = d
l.t = d
d.x = b
d.t = b
d.r = m
m.o = d
m.x = h
h.x = j
h.u = d
h.v = d
b.o = d
b.x = h
j.u = d
j.t = d
assert b.x.v.r.x.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.t: B = None
        self.txt = txt

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

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

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

l = A("l")
d = B("d")
m = C("m")
h = D("h")
b = C("b")
j = A("j")

l.u = d
l.t = d
d.x = b
d.t = b
d.r = m
m.o = d
m.x = h
h.x = j
h.u = d
h.v = d
b.o = d
b.x = h
j.u = d
j.t = d
assert b.x.v.r.x.u.r.txt == "m"