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

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

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

class D:
    def __init__(self, txt: str):
        self.q: B = None
        self.v: E = None
        self.w: A = None
        self.r: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: B = None
        self.u: F = None
        self.w: B = None
        self.txt = txt

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

f = A("f")
e = B("e")
h = C("h")
n = D("n")
a = E("a")
g = F("g")

f.y = h
e.z = f
e.x = f
e.y = g
e.r = g
e.t = a
h.x = e
h.r = a
h.y = a
h.v = g
n.q = e
n.v = a
n.w = f
n.r = h
a.y = e
a.w = e
a.u = g
g.r = n
g.u = n
g.t = e
g.x = f
assert e.t.u.t.z.y.x.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: B = None
        self.v: E = None
        self.w: A = None
        self.r: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: B = None
        self.u: F = None
        self.w: B = None
        self.txt = txt

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

f = A("f")
e = B("e")
h = C("h")
n = D("n")
a = E("a")
g = F("g")

f.y = h
e.z = f
e.x = f
e.y = g
e.r = g
e.t = a
h.x = e
h.r = a
h.y = a
h.v = g
n.q = e
n.v = a
n.w = f
n.r = h
a.y = e
a.w = e
a.u = g
g.r = n
g.u = n
g.t = e
g.x = f
assert e.t.u.t.z.y.x.txt == "e"