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

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

class C:
    def __init__(self, txt: str):
        self.z: B = None
        self.t: D = None
        self.txt = txt

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

b = A("b")
i = B("i")
l = C("l")
c = D("c")
f = A("f")

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

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

class C:
    def __init__(self, txt: str):
        self.z: B = None
        self.t: D = None
        self.txt = txt

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

b = A("b")
i = B("i")
l = C("l")
c = D("c")
f = A("f")

b.q = l
b.p = l
b.z = f
b.r = c
i.o = c
l.z = i
l.t = c
c.w = l
c.v = l
c.r = l
c.z = l
f.q = l
f.p = l
f.z = b
f.r = c
assert c.v.t.r.t.txt == "c"