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

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

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

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

i = A("i")
g = B("g")
n = C("n")
f = D("f")
k = B("k")
m = B("m")
a = D("a")
l = A("l")
e = A("e")
c = D("c")

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

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

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

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

i = A("i")
g = B("g")
n = C("n")
f = D("f")
k = B("k")
m = B("m")
a = D("a")
l = A("l")
e = A("e")
c = D("c")

i.r = n
g.x = n
g.u = n
g.v = f
n.y = f
n.s = a
n.r = c
f.p = n
f.w = n
f.s = n
f.r = m
k.x = n
k.u = n
k.v = c
m.x = n
m.u = n
m.v = a
a.p = n
a.w = n
a.s = n
a.r = k
l.r = n
e.r = n
c.p = n
c.w = n
c.s = n
c.r = k
assert e.r.y.p.y.r.v.s.r.r.v.txt == "c"