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

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

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

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

f = A("f")
g = B("g")
m = C("m")
e = D("e")
l = C("l")
d = D("d")
c = D("c")

f.y = m
f.z = m
f.v = c
f.q = g
g.z = e
g.x = m
g.s = m
m.r = f
e.o = g
e.y = g
e.x = f
e.z = m
l.r = f
d.o = g
d.y = g
d.x = f
d.z = l
c.o = g
c.y = g
c.x = f
c.z = m
assert c.o.x.r.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.v: D = None
        self.z: C = None
        self.q: B = None
        self.txt = txt

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

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

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

f = A("f")
g = B("g")
m = C("m")
e = D("e")
l = C("l")
d = D("d")
c = D("c")

f.y = m
f.z = m
f.v = c
f.q = g
g.z = e
g.x = m
g.s = m
m.r = f
e.o = g
e.y = g
e.x = f
e.z = m
l.r = f
d.o = g
d.y = g
d.x = f
d.z = l
c.o = g
c.y = g
c.x = f
c.z = m
assert c.o.x.r.txt == "f"