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

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

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

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

k = A("k")
i = B("i")
c = C("c")
a = D("a")
e = D("e")
b = A("b")
d = B("d")
m = D("m")

k.u = b
k.v = d
i.x = k
i.r = d
c.y = k
c.r = k
c.v = i
a.z = b
a.o = b
a.q = k
e.z = k
e.o = k
e.q = k
b.u = k
b.v = d
d.x = k
d.r = i
m.z = k
m.o = k
m.q = k
assert e.z.v.r.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.v: B = None
        self.txt = txt

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

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

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

k = A("k")
i = B("i")
c = C("c")
a = D("a")
e = D("e")
b = A("b")
d = B("d")
m = D("m")

k.u = b
k.v = d
i.x = k
i.r = d
c.y = k
c.r = k
c.v = i
a.z = b
a.o = b
a.q = k
e.z = k
e.o = k
e.q = k
b.u = k
b.v = d
d.x = k
d.r = i
m.z = k
m.o = k
m.q = k
assert e.z.v.r.txt == "i"