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

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

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

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

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

k = A("k")
b = B("b")
g = C("g")
m = D("m")
a = E("a")
f = C("f")
i = C("i")
c = E("c")

k.u = b
k.s = b
b.z = g
b.w = g
g.x = c
g.t = a
g.y = a
g.r = k
m.x = c
a.r = k
a.w = i
f.x = a
f.t = c
f.y = c
f.r = k
i.x = c
i.t = a
i.y = a
i.r = k
c.r = k
c.w = i
assert g.t.r.u.z.x.r.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.s: B = None
        self.txt = txt

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

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

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

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

k = A("k")
b = B("b")
g = C("g")
m = D("m")
a = E("a")
f = C("f")
i = C("i")
c = E("c")

k.u = b
k.s = b
b.z = g
b.w = g
g.x = c
g.t = a
g.y = a
g.r = k
m.x = c
a.r = k
a.w = i
f.x = a
f.t = c
f.y = c
f.r = k
i.x = c
i.t = a
i.y = a
i.r = k
c.r = k
c.w = i
assert g.t.r.u.z.x.r.u.txt == "b"