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

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.q: C = None
        self.u: B = None
        self.txt = txt

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

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

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

a.r = l
a.v = h
a.p = c
k.o = l
k.q = l
k.u = g
l.p = h
l.r = k
l.u = m
h.s = i
h.v = m
c.r = l
c.v = i
c.p = m
g.o = l
g.q = l
g.u = k
m.r = l
m.v = h
m.p = c
e.o = l
e.q = l
e.u = k
i.s = h
i.v = c
assert i.v.v.s.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.v: D = None
        self.p: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.q: C = None
        self.u: B = None
        self.txt = txt

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

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

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

a.r = l
a.v = h
a.p = c
k.o = l
k.q = l
k.u = g
l.p = h
l.r = k
l.u = m
h.s = i
h.v = m
c.r = l
c.v = i
c.p = m
g.o = l
g.q = l
g.u = k
m.r = l
m.v = h
m.p = c
e.o = l
e.q = l
e.u = k
i.s = h
i.v = c
assert i.v.v.s.txt == "h"