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

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

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

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

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

l.u = c
c.p = l
m.t = l
n.v = i
n.x = c
n.o = h
h.u = c
i.u = c
g.v = h
g.o = h
g.x = c
e.t = h
assert g.o.u.p.u.p.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

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

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

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

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

l.u = c
c.p = l
m.t = l
n.v = i
n.x = c
n.o = h
h.u = c
i.u = c
g.v = h
g.o = h
g.x = c
e.t = h
assert g.o.u.p.u.p.u.txt == "c"