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

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

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

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.x: A = None
        self.txt = txt

f = A("f")
g = B("g")
h = C("h")
a = D("a")
b = E("b")
l = B("l")
k = D("k")
m = A("m")

f.s = b
f.t = g
f.p = k
g.u = h
h.x = b
a.p = b
b.u = l
b.x = f
l.u = h
k.p = b
m.s = b
m.t = g
m.p = k
assert m.t.u.x.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.s: E = None
        self.t: B = None
        self.p: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.x: A = None
        self.txt = txt

f = A("f")
g = B("g")
h = C("h")
a = D("a")
b = E("b")
l = B("l")
k = D("k")
m = A("m")

f.s = b
f.t = g
f.p = k
g.u = h
h.x = b
a.p = b
b.u = l
b.x = f
l.u = h
k.p = b
m.s = b
m.t = g
m.p = k
assert m.t.u.x.u.u.txt == "h"