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

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

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

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

i = A("i")
b = B("b")
d = C("d")
n = D("n")
g = B("g")
m = A("m")
k = C("k")
l = C("l")

i.x = m
i.o = n
i.w = d
i.s = b
b.t = m
d.x = k
d.r = n
d.v = g
n.p = g
n.t = k
n.r = d
g.t = i
m.x = i
m.o = n
m.w = l
m.s = b
k.x = d
k.r = n
k.v = g
l.x = d
l.r = n
l.v = b
assert g.t.x.s.t.w.v.t.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.o: D = None
        self.w: C = None
        self.s: B = None
        self.txt = txt

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

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

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

i = A("i")
b = B("b")
d = C("d")
n = D("n")
g = B("g")
m = A("m")
k = C("k")
l = C("l")

i.x = m
i.o = n
i.w = d
i.s = b
b.t = m
d.x = k
d.r = n
d.v = g
n.p = g
n.t = k
n.r = d
g.t = i
m.x = i
m.o = n
m.w = l
m.s = b
k.x = d
k.r = n
k.v = g
l.x = d
l.r = n
l.v = b
assert g.t.x.s.t.w.v.t.x.txt == "i"