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

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

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

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

e = A("e")
c = B("c")
b = C("b")
g = D("g")
n = D("n")
h = C("h")
a = A("a")
i = C("i")
j = C("j")

e.t = n
c.r = a
c.s = b
c.t = b
c.o = e
b.p = n
g.q = n
g.v = n
g.s = h
n.q = g
n.v = g
n.s = b
h.p = g
a.t = g
i.p = g
j.p = n
assert j.p.q.v.s.p.s.p.s.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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

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

e = A("e")
c = B("c")
b = C("b")
g = D("g")
n = D("n")
h = C("h")
a = A("a")
i = C("i")
j = C("j")

e.t = n
c.r = a
c.s = b
c.t = b
c.o = e
b.p = n
g.q = n
g.v = n
g.s = h
n.q = g
n.v = g
n.s = b
h.p = g
a.t = g
i.p = g
j.p = n
assert j.p.q.v.s.p.s.p.s.txt == "b"