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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: D = None
        self.v: A = None
        self.u: C = None
        self.y: A = None
        self.t: B = None
        self.txt = txt

h = A("h")
d = B("d")
k = C("k")
a = D("a")
f = E("f")
l = B("l")

h.r = d
h.w = d
h.x = a
h.s = a
d.z = a
d.v = a
d.o = h
d.t = f
d.r = k
k.v = f
a.s = d
a.p = d
f.q = a
f.v = h
f.y = h
f.u = k
f.t = d
l.z = a
l.v = a
l.o = h
l.t = f
l.r = k
assert f.q.p.o.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: D = None
        self.s: D = None
        self.w: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: D = None
        self.v: A = None
        self.u: C = None
        self.y: A = None
        self.t: B = None
        self.txt = txt

h = A("h")
d = B("d")
k = C("k")
a = D("a")
f = E("f")
l = B("l")

h.r = d
h.w = d
h.x = a
h.s = a
d.z = a
d.v = a
d.o = h
d.t = f
d.r = k
k.v = f
a.s = d
a.p = d
f.q = a
f.v = h
f.y = h
f.u = k
f.t = d
l.z = a
l.v = a
l.o = h
l.t = f
l.r = k
assert f.q.p.o.txt == "h"