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

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: A = None
        self.y: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: D = None
        self.o: A = None
        self.txt = txt

a = A("a")
n = B("n")
m = C("m")
h = D("h")
f = E("f")
l = F("l")
b = F("b")

a.r = h
a.x = f
a.o = m
a.s = n
n.y = h
n.x = h
n.w = m
n.s = b
m.x = h
h.z = a
h.u = a
f.z = a
f.y = b
l.t = h
l.o = a
b.t = h
b.o = a
assert f.z.x.z.r.u.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.x: E = None
        self.o: C = None
        self.s: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: A = None
        self.y: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: D = None
        self.o: A = None
        self.txt = txt

a = A("a")
n = B("n")
m = C("m")
h = D("h")
f = E("f")
l = F("l")
b = F("b")

a.r = h
a.x = f
a.o = m
a.s = n
n.y = h
n.x = h
n.w = m
n.s = b
m.x = h
h.z = a
h.u = a
f.z = a
f.y = b
l.t = h
l.o = a
b.t = h
b.o = a
assert f.z.x.z.r.u.txt == "a"