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

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

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

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

f = A("f")
a = B("a")
d = C("d")
m = D("m")
b = A("b")
l = B("l")
k = D("k")

f.v = l
f.t = d
f.z = d
a.z = b
a.v = b
a.r = d
a.o = m
d.r = k
d.y = k
m.z = a
m.v = f
m.q = k
b.v = a
b.t = d
b.z = d
l.z = b
l.v = b
l.r = d
l.o = k
k.z = l
k.v = f
k.q = m
assert f.v.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.t: C = None
        self.z: C = None
        self.txt = txt

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

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

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

f = A("f")
a = B("a")
d = C("d")
m = D("m")
b = A("b")
l = B("l")
k = D("k")

f.v = l
f.t = d
f.z = d
a.z = b
a.v = b
a.r = d
a.o = m
d.r = k
d.y = k
m.z = a
m.v = f
m.q = k
b.v = a
b.t = d
b.z = d
l.z = b
l.v = b
l.r = d
l.o = k
k.z = l
k.v = f
k.q = m
assert f.v.r.r.txt == "k"