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

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.x: A = None
        self.o: A = None
        self.p: E = None
        self.q: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.u: D = None
        self.y: B = None
        self.v: B = None
        self.txt = txt

g = A("g")
n = B("n")
i = C("i")
c = D("c")
f = E("f")
l = C("l")
b = D("b")

g.t = n
n.t = f
n.p = f
n.x = g
n.o = g
n.q = b
i.u = n
i.o = b
i.s = g
c.y = l
c.q = b
c.o = b
f.u = c
f.y = n
f.v = n
l.u = n
l.o = b
l.s = g
b.y = i
b.q = c
b.o = c
assert l.o.q.q.o.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.x: A = None
        self.o: A = None
        self.p: E = None
        self.q: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.u: D = None
        self.y: B = None
        self.v: B = None
        self.txt = txt

g = A("g")
n = B("n")
i = C("i")
c = D("c")
f = E("f")
l = C("l")
b = D("b")

g.t = n
n.t = f
n.p = f
n.x = g
n.o = g
n.q = b
i.u = n
i.o = b
i.s = g
c.y = l
c.q = b
c.o = b
f.u = c
f.y = n
f.v = n
l.u = n
l.o = b
l.s = g
b.y = i
b.q = c
b.o = c
assert l.o.q.q.o.y.txt == "l"