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

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

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

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

g = A("g")
i = B("i")
f = C("f")
h = D("h")
j = D("j")
k = D("k")
m = B("m")
e = A("e")
l = C("l")

g.x = k
g.u = k
g.v = f
g.r = m
i.o = k
f.o = k
f.r = g
f.w = j
h.t = l
j.t = l
k.t = l
m.o = h
e.x = h
e.v = l
e.r = i
e.u = j
l.o = k
l.r = g
l.w = h
assert f.w.t.r.x.t.o.t.r.v.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.v: C = None
        self.r: B = None
        self.u: D = None
        self.txt = txt

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

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

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

g = A("g")
i = B("i")
f = C("f")
h = D("h")
j = D("j")
k = D("k")
m = B("m")
e = A("e")
l = C("l")

g.x = k
g.u = k
g.v = f
g.r = m
i.o = k
f.o = k
f.r = g
f.w = j
h.t = l
j.t = l
k.t = l
m.o = h
e.x = h
e.v = l
e.r = i
e.u = j
l.o = k
l.r = g
l.w = h
assert f.w.t.r.x.t.o.t.r.v.txt == "f"