class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.y: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: B = None
        self.p: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: E = None
        self.u: F = None
        self.p: E = None
        self.w: A = None
        self.txt = txt

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

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

a = A("a")
n = B("n")
g = C("g")
c = D("c")
f = E("f")
l = F("l")
e = C("e")
j = E("j")
k = B("k")

a.o = j
a.y = l
n.t = a
n.p = a
n.q = a
n.y = k
n.v = c
g.q = n
g.p = l
c.s = f
c.p = f
c.u = l
c.w = a
f.r = k
f.o = k
f.z = g
l.r = g
e.q = k
e.p = l
j.r = n
j.o = n
j.z = e
k.t = a
k.p = a
k.q = a
k.y = n
k.v = c
assert l.r.p.r.p.r.p.txt == "
class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.y: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: B = None
        self.p: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: E = None
        self.u: F = None
        self.p: E = None
        self.w: A = None
        self.txt = txt

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

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

a = A("a")
n = B("n")
g = C("g")
c = D("c")
f = E("f")
l = F("l")
e = C("e")
j = E("j")
k = B("k")

a.o = j
a.y = l
n.t = a
n.p = a
n.q = a
n.y = k
n.v = c
g.q = n
g.p = l
c.s = f
c.p = f
c.u = l
c.w = a
f.r = k
f.o = k
f.z = g
l.r = g
e.q = k
e.p = l
j.r = n
j.o = n
j.z = e
k.t = a
k.p = a
k.q = a
k.y = n
k.v = c
assert l.r.p.r.p.r.p.txt == "l"