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

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

class C:
    def __init__(self, txt: str):
        self.s: C = None
        self.x: C = None
        self.y: B = None
        self.o: B = None
        self.txt = txt

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

h = A("h")
k = B("k")
j = C("j")
m = D("m")
f = C("f")
b = B("b")
n = B("n")

h.v = n
k.s = j
k.y = h
k.r = h
k.x = f
j.s = f
j.x = f
j.y = b
j.o = k
m.q = b
m.u = b
f.s = j
f.x = j
f.y = b
f.o = b
b.s = j
b.y = h
b.r = h
b.x = f
n.s = f
n.y = h
n.r = h
n.x = j
assert k.y.v.y.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: C = None
        self.x: C = None
        self.y: B = None
        self.o: B = None
        self.txt = txt

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

h = A("h")
k = B("k")
j = C("j")
m = D("m")
f = C("f")
b = B("b")
n = B("n")

h.v = n
k.s = j
k.y = h
k.r = h
k.x = f
j.s = f
j.x = f
j.y = b
j.o = k
m.q = b
m.u = b
f.s = j
f.x = j
f.y = b
f.o = b
b.s = j
b.y = h
b.r = h
b.x = f
n.s = f
n.y = h
n.r = h
n.x = j
assert k.y.v.y.txt == "h"