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

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

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

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

g = A("g")
b = B("b")
d = C("d")
h = D("h")
l = A("l")
f = B("f")

g.r = l
g.w = l
g.o = l
g.x = b
b.x = f
b.t = d
b.s = l
d.q = l
d.v = b
d.y = b
d.z = g
h.x = f
h.s = g
l.r = g
l.w = g
l.o = g
l.x = b
f.x = b
f.t = d
f.s = g
assert g.x.t.z.x.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.w: A = None
        self.o: A = None
        self.x: B = None
        self.txt = txt

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

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

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

g = A("g")
b = B("b")
d = C("d")
h = D("h")
l = A("l")
f = B("f")

g.r = l
g.w = l
g.o = l
g.x = b
b.x = f
b.t = d
b.s = l
d.q = l
d.v = b
d.y = b
d.z = g
h.x = f
h.s = g
l.r = g
l.w = g
l.o = g
l.x = b
f.x = b
f.t = d
f.s = g
assert g.x.t.z.x.t.z.txt == "g"