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

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

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

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

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

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

m.r = c
b.v = m
f.u = c
j.o = b
k.t = c
k.z = b
k.q = m
c.t = k
c.z = b
c.q = m
assert k.q.r.q.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.txt = txt

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

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

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

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

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

m.r = c
b.v = m
f.u = c
j.o = b
k.t = c
k.z = b
k.q = m
c.t = k
c.z = b
c.q = m
assert k.q.r.q.r.txt == "c"