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

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

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

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

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

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

f.p = k
f.r = c
f.y = c
f.v = i
k.t = f
k.x = f
k.s = g
k.y = c
k.q = c
c.o = i
g.s = c
g.q = k
g.o = k
g.p = k
g.v = f
i.p = g
i.w = f
b.p = g
b.w = f
assert f.y.o.w.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.r: C = None
        self.y: C = None
        self.v: E = None
        self.txt = txt

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

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

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

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

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

f.p = k
f.r = c
f.y = c
f.v = i
k.t = f
k.x = f
k.s = g
k.y = c
k.q = c
c.o = i
g.s = c
g.q = k
g.o = k
g.p = k
g.v = f
i.p = g
i.w = f
b.p = g
b.w = f
assert f.y.o.w.p.txt == "k"