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

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

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

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

k = A("k")
i = B("i")
c = C("c")
a = D("a")
f = C("f")
b = A("b")
j = D("j")
m = D("m")
n = B("n")

k.q = c
i.o = n
i.v = a
c.y = b
c.o = j
c.x = k
c.r = k
a.r = f
a.o = b
f.y = b
f.o = a
f.x = k
f.r = k
b.q = f
j.r = f
j.o = k
m.r = c
m.o = b
n.o = i
n.v = m
assert c.o.r.x.q.r.q.y.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

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

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

k = A("k")
i = B("i")
c = C("c")
a = D("a")
f = C("f")
b = A("b")
j = D("j")
m = D("m")
n = B("n")

k.q = c
i.o = n
i.v = a
c.y = b
c.o = j
c.x = k
c.r = k
a.r = f
a.o = b
f.y = b
f.o = a
f.x = k
f.r = k
b.q = f
j.r = f
j.o = k
m.r = c
m.o = b
n.o = i
n.v = m
assert c.o.r.x.q.r.q.y.q.txt == "f"