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

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

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

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

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

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

l.x = b
l.t = c
l.r = f
c.y = f
c.r = a
m.u = f
g.s = l
a.p = e
a.u = m
a.t = c
a.r = c
j.p = g
j.u = m
j.t = c
j.r = c
n.s = l
b.x = l
b.t = c
b.r = f
f.u = m
e.s = l
assert b.t.r.p.s.r.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.t: B = None
        self.r: C = None
        self.txt = txt

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

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

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

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

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

l.x = b
l.t = c
l.r = f
c.y = f
c.r = a
m.u = f
g.s = l
a.p = e
a.u = m
a.t = c
a.r = c
j.p = g
j.u = m
j.t = c
j.r = c
n.s = l
b.x = l
b.t = c
b.r = f
f.u = m
e.s = l
assert b.t.r.p.s.r.u.u.txt == "f"