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

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

class C:
    def __init__(self, txt: str):
        self.w: E = None
        self.p: A = None
        self.x: E = None
        self.txt = txt

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

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

h = A("h")
f = B("f")
c = C("c")
m = D("m")
j = E("j")
l = D("l")
a = E("a")
k = E("k")
i = B("i")
b = A("b")

h.o = b
h.t = c
f.t = m
f.v = b
f.s = l
f.o = h
f.q = h
c.w = k
c.x = k
c.p = h
m.p = c
j.r = c
l.p = c
a.r = c
k.r = c
i.t = l
i.v = b
i.o = b
i.q = b
i.s = m
b.o = h
b.t = c
assert l.p.p.o.t.p.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.t: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: E = None
        self.p: A = None
        self.x: E = None
        self.txt = txt

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

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

h = A("h")
f = B("f")
c = C("c")
m = D("m")
j = E("j")
l = D("l")
a = E("a")
k = E("k")
i = B("i")
b = A("b")

h.o = b
h.t = c
f.t = m
f.v = b
f.s = l
f.o = h
f.q = h
c.w = k
c.x = k
c.p = h
m.p = c
j.r = c
l.p = c
a.r = c
k.r = c
i.t = l
i.v = b
i.o = b
i.q = b
i.s = m
b.o = h
b.t = c
assert l.p.p.o.t.p.o.txt == "b"