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

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

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

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

h = A("h")
a = B("a")
i = C("i")
g = D("g")
d = D("d")
k = C("k")
c = D("c")
e = D("e")
n = C("n")
l = B("l")

h.p = g
h.v = a
a.v = l
a.q = l
a.t = h
a.p = h
i.o = h
g.o = c
d.o = g
k.o = h
c.o = e
e.o = g
n.o = h
l.v = a
l.q = a
l.t = h
l.p = h
assert c.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.v: B = None
        self.txt = txt

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

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

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

h = A("h")
a = B("a")
i = C("i")
g = D("g")
d = D("d")
k = C("k")
c = D("c")
e = D("e")
n = C("n")
l = B("l")

h.p = g
h.v = a
a.v = l
a.q = l
a.t = h
a.p = h
i.o = h
g.o = c
d.o = g
k.o = h
c.o = e
e.o = g
n.o = h
l.v = a
l.q = a
l.t = h
l.p = h
assert c.o.o.o.txt == "c"