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

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

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.p: D = None
        self.z: A = None
        self.r: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: E = None
        self.q: E = None
        self.o: A = None
        self.txt = txt

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

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

c.r = i
c.t = i
c.v = k
c.o = f
i.y = c
f.o = c
f.z = c
f.p = k
f.r = k
k.r = j
k.q = j
k.o = c
j.r = f
assert i.y.v.o.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.v: D = None
        self.t: B = None
        self.o: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.p: D = None
        self.z: A = None
        self.r: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: E = None
        self.q: E = None
        self.o: A = None
        self.txt = txt

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

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

c.r = i
c.t = i
c.v = k
c.o = f
i.y = c
f.o = c
f.z = c
f.p = k
f.r = k
k.r = j
k.q = j
k.o = c
j.r = f
assert i.y.v.o.txt == "c"