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

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

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

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

k = A("k")
e = B("e")
g = C("g")
b = D("b")
j = B("j")
f = D("f")
c = A("c")
i = C("i")

k.y = b
k.o = b
k.w = c
e.y = k
e.u = k
e.t = i
g.t = e
g.r = e
g.z = f
g.y = i
b.x = f
b.u = f
j.y = k
j.u = k
j.t = g
f.x = b
f.u = b
c.y = b
c.o = b
c.w = k
i.t = e
i.z = b
i.r = j
i.y = g
assert k.w.o.u.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.w: A = None
        self.o: D = None
        self.txt = txt

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

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

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

k = A("k")
e = B("e")
g = C("g")
b = D("b")
j = B("j")
f = D("f")
c = A("c")
i = C("i")

k.y = b
k.o = b
k.w = c
e.y = k
e.u = k
e.t = i
g.t = e
g.r = e
g.z = f
g.y = i
b.x = f
b.u = f
j.y = k
j.u = k
j.t = g
f.x = b
f.u = b
c.y = b
c.o = b
c.w = k
i.t = e
i.z = b
i.r = j
i.y = g
assert k.w.o.u.txt == "f"