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

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

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

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

g = A("g")
m = B("m")
e = C("e")
j = D("j")
a = C("a")
d = D("d")
b = A("b")
l = C("l")
f = C("f")

g.y = d
g.q = d
g.p = b
g.o = b
m.t = j
m.u = j
m.p = e
e.r = m
e.p = g
j.w = a
j.t = a
a.r = m
a.p = b
d.w = f
d.t = e
b.y = j
b.p = g
b.o = g
b.q = d
l.r = m
l.p = b
f.r = m
f.p = g
assert l.p.q.t.r.u.w.p.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.p: A = None
        self.q: D = None
        self.o: A = None
        self.txt = txt

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

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

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

g = A("g")
m = B("m")
e = C("e")
j = D("j")
a = C("a")
d = D("d")
b = A("b")
l = C("l")
f = C("f")

g.y = d
g.q = d
g.p = b
g.o = b
m.t = j
m.u = j
m.p = e
e.r = m
e.p = g
j.w = a
j.t = a
a.r = m
a.p = b
d.w = f
d.t = e
b.y = j
b.p = g
b.o = g
b.q = d
l.r = m
l.p = b
f.r = m
f.p = g
assert l.p.q.t.r.u.w.p.p.p.txt == "b"