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

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

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

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

i = A("i")
k = B("k")
b = C("b")
d = D("d")
l = C("l")

i.r = l
i.p = l
i.u = d
k.s = i
k.w = i
k.v = b
b.z = k
b.x = l
b.y = d
b.q = i
d.y = l
l.z = k
l.x = b
l.y = d
l.q = i
assert d.y.x.z.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.p: C = None
        self.u: D = None
        self.txt = txt

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

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

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

i = A("i")
k = B("k")
b = C("b")
d = D("d")
l = C("l")

i.r = l
i.p = l
i.u = d
k.s = i
k.w = i
k.v = b
b.z = k
b.x = l
b.y = d
b.q = i
d.y = l
l.z = k
l.x = b
l.y = d
l.q = i
assert d.y.x.z.v.txt == "b"