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

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

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

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

c = A("c")
b = B("b")
h = C("h")
f = D("f")
g = C("g")
a = B("a")
l = D("l")

c.y = l
c.s = h
b.s = a
b.w = c
b.v = c
b.o = h
h.u = c
h.t = c
h.r = g
h.x = g
f.v = c
f.o = c
f.u = c
f.y = b
g.u = c
g.t = c
g.r = h
g.x = h
a.s = b
a.w = c
a.v = c
a.o = h
l.v = c
l.o = c
l.u = c
l.y = a
assert g.u.y.v.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.s: C = None
        self.txt = txt

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

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

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

c = A("c")
b = B("b")
h = C("h")
f = D("f")
g = C("g")
a = B("a")
l = D("l")

c.y = l
c.s = h
b.s = a
b.w = c
b.v = c
b.o = h
h.u = c
h.t = c
h.r = g
h.x = g
f.v = c
f.o = c
f.u = c
f.y = b
g.u = c
g.t = c
g.r = h
g.x = h
a.s = b
a.w = c
a.v = c
a.o = h
l.v = c
l.o = c
l.u = c
l.y = a
assert g.u.y.v.txt == "c"