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

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.v: B = None
        self.p: B = None
        self.txt = txt

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

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

m = A("m")
h = B("h")
j = C("j")
g = D("g")
c = B("c")
n = A("n")
l = D("l")

m.o = g
m.t = n
h.s = j
h.v = c
h.p = c
j.u = g
j.p = c
g.o = j
c.s = j
c.v = h
c.p = h
n.o = l
n.t = m
l.o = j
assert m.t.o.o.u.o.p.s.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.t: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.v: B = None
        self.p: B = None
        self.txt = txt

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

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

m = A("m")
h = B("h")
j = C("j")
g = D("g")
c = B("c")
n = A("n")
l = D("l")

m.o = g
m.t = n
h.s = j
h.v = c
h.p = c
j.u = g
j.p = c
g.o = j
c.s = j
c.v = h
c.p = h
n.o = l
n.t = m
l.o = j
assert m.t.o.o.u.o.p.s.txt == "j"