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

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

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

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

i = A("i")
a = B("a")
f = C("f")
l = D("l")
e = D("e")
c = B("c")

i.s = e
i.p = l
a.o = f
a.x = f
a.v = l
a.s = c
f.u = l
f.x = l
f.o = c
f.y = a
l.s = i
l.x = i
l.v = e
l.o = f
e.s = i
e.x = i
e.v = l
e.o = f
c.o = f
c.x = f
c.v = l
c.s = a
assert f.y.x.y.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.p: D = None
        self.txt = txt

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

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

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

i = A("i")
a = B("a")
f = C("f")
l = D("l")
e = D("e")
c = B("c")

i.s = e
i.p = l
a.o = f
a.x = f
a.v = l
a.s = c
f.u = l
f.x = l
f.o = c
f.y = a
l.s = i
l.x = i
l.v = e
l.o = f
e.s = i
e.x = i
e.v = l
e.o = f
c.o = f
c.x = f
c.v = l
c.s = a
assert f.y.x.y.txt == "a"