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

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

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

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

f = A("f")
d = B("d")
m = C("m")
k = D("k")
c = A("c")
h = C("h")

f.s = d
d.t = k
d.y = m
d.r = f
m.y = d
m.v = c
m.s = f
k.p = f
c.s = d
h.y = d
h.v = c
h.s = c
assert c.s.t.p.s.y.v.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

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

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

f = A("f")
d = B("d")
m = C("m")
k = D("k")
c = A("c")
h = C("h")

f.s = d
d.t = k
d.y = m
d.r = f
m.y = d
m.v = c
m.s = f
k.p = f
c.s = d
h.y = d
h.v = c
h.s = c
assert c.s.t.p.s.y.v.txt == "c"