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

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

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

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

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

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

f.z = n
f.s = n
f.u = n
f.r = b
k.t = c
n.y = b
g.r = b
g.w = b
g.y = f
g.z = m
b.v = k
b.r = m
b.u = c
m.z = n
m.s = n
m.u = n
m.r = b
c.t = k
assert f.r.v.t.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.r: E = None
        self.s: C = None
        self.u: C = None
        self.txt = txt

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

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

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

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

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

f.z = n
f.s = n
f.u = n
f.r = b
k.t = c
n.y = b
g.r = b
g.w = b
g.y = f
g.z = m
b.v = k
b.r = m
b.u = c
m.z = n
m.s = n
m.u = n
m.r = b
c.t = k
assert f.r.v.t.t.t.t.txt == "k"