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

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

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

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

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

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

b.q = g
b.x = k
e.z = i
e.r = i
e.q = a
g.o = f
a.w = g
a.v = i
i.r = g
f.q = g
f.x = k
k.z = i
k.r = i
k.q = a
assert e.z.r.o.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.x: B = None
        self.txt = txt

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

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

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

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

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

b.q = g
b.x = k
e.z = i
e.r = i
e.q = a
g.o = f
a.w = g
a.v = i
i.r = g
f.q = g
f.x = k
k.z = i
k.r = i
k.q = a
assert e.z.r.o.txt == "f"