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

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

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

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

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

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

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

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

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

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

e.y = j
e.p = h
e.t = d
l.o = n
j.v = m
m.x = d
m.r = j
g.y = j
g.p = h
g.t = d
n.y = h
n.p = h
n.t = d
h.v = m
d.o = c
c.y = h
c.p = j
c.t = l
assert e.t.o.p.v.x.o.t.o.txt == "n"