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

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

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

class D:
    def __init__(self, txt: str):
        self.y: C = None
        self.t: D = None
        self.r: C = None
        self.u: C = None
        self.txt = txt

l = A("l")
f = B("f")
d = C("d")
g = D("g")
j = C("j")
m = C("m")
n = B("n")
c = A("c")
k = C("k")
i = D("i")

l.o = k
l.u = f
l.x = g
l.p = g
f.u = n
d.u = j
g.y = j
g.r = j
g.t = i
g.u = m
j.u = m
m.u = k
n.u = f
c.o = d
c.u = n
c.x = g
c.p = i
k.u = m
i.y = d
i.t = g
i.r = m
i.u = k
assert i.t.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.u: B = None
        self.x: D = None
        self.p: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: C = None
        self.t: D = None
        self.r: C = None
        self.u: C = None
        self.txt = txt

l = A("l")
f = B("f")
d = C("d")
g = D("g")
j = C("j")
m = C("m")
n = B("n")
c = A("c")
k = C("k")
i = D("i")

l.o = k
l.u = f
l.x = g
l.p = g
f.u = n
d.u = j
g.y = j
g.r = j
g.t = i
g.u = m
j.u = m
m.u = k
n.u = f
c.o = d
c.u = n
c.x = g
c.p = i
k.u = m
i.y = d
i.t = g
i.r = m
i.u = k
assert i.t.u.u.u.u.txt == "k"