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

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

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.o: C = None
        self.q: B = None
        self.s: E = None
        self.txt = txt

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

h = A("h")
d = B("d")
n = C("n")
f = D("f")
c = E("c")
k = D("k")

h.v = d
h.x = d
h.s = c
h.p = c
h.u = c
d.t = f
d.z = f
d.u = h
d.r = c
n.r = d
f.p = d
f.q = d
f.o = n
f.s = c
c.s = d
k.p = d
k.q = d
k.o = n
k.s = c
assert f.s.s.r.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.x: B = None
        self.s: E = None
        self.p: E = None
        self.u: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.o: C = None
        self.q: B = None
        self.s: E = None
        self.txt = txt

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

h = A("h")
d = B("d")
n = C("n")
f = D("f")
c = E("c")
k = D("k")

h.v = d
h.x = d
h.s = c
h.p = c
h.u = c
d.t = f
d.z = f
d.u = h
d.r = c
n.r = d
f.p = d
f.q = d
f.o = n
f.s = c
c.s = d
k.p = d
k.q = d
k.o = n
k.s = c
assert f.s.s.r.txt == "c"