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

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

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

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

m = A("m")
e = B("e")
d = C("d")
j = D("j")
a = B("a")
l = A("l")
i = D("i")
h = C("h")

m.t = j
m.v = l
m.s = l
e.o = d
e.r = j
d.u = a
j.q = i
j.s = i
j.r = i
a.o = d
a.r = j
l.t = j
l.v = m
l.s = m
i.q = j
i.s = j
i.r = j
h.u = a
assert e.o.u.o.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.v: A = None
        self.s: A = None
        self.txt = txt

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

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

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

m = A("m")
e = B("e")
d = C("d")
j = D("j")
a = B("a")
l = A("l")
i = D("i")
h = C("h")

m.t = j
m.v = l
m.s = l
e.o = d
e.r = j
d.u = a
j.q = i
j.s = i
j.r = i
a.o = d
a.r = j
l.t = j
l.v = m
l.s = m
i.q = j
i.s = j
i.r = j
h.u = a
assert e.o.u.o.u.r.txt == "j"