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

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

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

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

a = A("a")
b = B("b")
c = C("c")
k = D("k")
g = A("g")
h = A("h")

a.v = g
a.r = c
a.p = h
a.t = k
b.o = k
b.t = c
c.o = b
c.s = b
c.u = h
c.y = h
k.p = a
k.t = b
g.v = h
g.p = h
g.r = c
g.t = k
h.v = g
h.p = g
h.r = c
h.t = k
assert a.p.r.y.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.r: C = None
        self.p: A = None
        self.t: D = None
        self.txt = txt

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

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

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

a = A("a")
b = B("b")
c = C("c")
k = D("k")
g = A("g")
h = A("h")

a.v = g
a.r = c
a.p = h
a.t = k
b.o = k
b.t = c
c.o = b
c.s = b
c.u = h
c.y = h
k.p = a
k.t = b
g.v = h
g.p = h
g.r = c
g.t = k
h.v = g
h.p = g
h.r = c
h.t = k
assert a.p.r.y.txt == "h"