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

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

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

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

g = A("g")
k = B("k")
c = C("c")
l = D("l")
a = A("a")
i = D("i")

g.r = i
g.w = c
g.u = c
g.z = c
k.x = c
k.y = l
c.s = l
l.y = i
a.r = i
a.w = c
a.u = c
a.z = c
i.y = l
assert a.r.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.w: C = None
        self.u: C = None
        self.z: C = None
        self.txt = txt

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

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

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

g = A("g")
k = B("k")
c = C("c")
l = D("l")
a = A("a")
i = D("i")

g.r = i
g.w = c
g.u = c
g.z = c
k.x = c
k.y = l
c.s = l
l.y = i
a.r = i
a.w = c
a.u = c
a.z = c
i.y = l
assert a.r.y.y.txt == "i"