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

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

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

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

f = A("f")
n = B("n")
b = C("b")
d = D("d")
j = B("j")
k = B("k")
l = A("l")
c = C("c")
i = C("i")
g = D("g")

f.o = l
f.q = l
n.w = l
n.p = b
n.y = f
b.v = g
b.r = g
b.t = d
b.y = i
d.o = b
d.s = i
j.w = l
j.y = l
j.p = b
k.w = f
k.y = f
k.p = b
l.o = f
l.q = f
c.v = g
c.t = d
c.r = d
c.y = i
i.v = d
i.t = d
i.r = d
i.y = c
g.o = b
g.s = b
assert l.o.o.o.o.o.q.o.o.q.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.q: A = None
        self.txt = txt

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

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

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

f = A("f")
n = B("n")
b = C("b")
d = D("d")
j = B("j")
k = B("k")
l = A("l")
c = C("c")
i = C("i")
g = D("g")

f.o = l
f.q = l
n.w = l
n.p = b
n.y = f
b.v = g
b.r = g
b.t = d
b.y = i
d.o = b
d.s = i
j.w = l
j.y = l
j.p = b
k.w = f
k.y = f
k.p = b
l.o = f
l.q = f
c.v = g
c.t = d
c.r = d
c.y = i
i.v = d
i.t = d
i.r = d
i.y = c
g.o = b
g.s = b
assert l.o.o.o.o.o.q.o.o.q.o.txt == "l"