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

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

class C:
    def __init__(self, txt: str):
        self.t: C = None
        self.o: C = None
        self.txt = txt

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

g = A("g")
l = B("l")
b = C("b")
n = D("n")
f = A("f")
k = C("k")
m = C("m")
i = D("i")

g.y = f
g.p = k
g.v = b
l.w = n
b.t = k
b.o = k
n.s = i
n.x = l
n.u = f
n.r = b
f.y = g
f.p = k
f.v = k
k.t = m
k.o = m
m.t = k
m.o = k
i.s = n
i.x = l
i.u = f
i.r = b
assert l.w.s.x.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.p: C = None
        self.v: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: C = None
        self.o: C = None
        self.txt = txt

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

g = A("g")
l = B("l")
b = C("b")
n = D("n")
f = A("f")
k = C("k")
m = C("m")
i = D("i")

g.y = f
g.p = k
g.v = b
l.w = n
b.t = k
b.o = k
n.s = i
n.x = l
n.u = f
n.r = b
f.y = g
f.p = k
f.v = k
k.t = m
k.o = m
m.t = k
m.o = k
i.s = n
i.x = l
i.u = f
i.r = b
assert l.w.s.x.txt == "l"