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

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

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

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

c = A("c")
j = B("j")
k = C("k")
h = D("h")
i = B("i")
a = B("a")
l = C("l")

c.y = l
c.r = l
j.s = a
j.y = c
j.o = h
k.v = c
k.x = h
k.y = h
h.q = i
i.s = j
i.y = c
i.o = h
a.s = i
a.y = c
a.o = h
l.v = c
l.x = h
l.y = h
assert j.o.q.s.o.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.r: C = None
        self.txt = txt

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

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

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

c = A("c")
j = B("j")
k = C("k")
h = D("h")
i = B("i")
a = B("a")
l = C("l")

c.y = l
c.r = l
j.s = a
j.y = c
j.o = h
k.v = c
k.x = h
k.y = h
h.q = i
i.s = j
i.y = c
i.o = h
a.s = i
a.y = c
a.o = h
l.v = c
l.x = h
l.y = h
assert j.o.q.s.o.txt == "h"