class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.s: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.y: D = None
        self.txt = txt

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

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

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

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

l = A("l")
k = B("k")
a = C("a")
f = D("f")
e = E("e")
g = F("g")

l.u = a
l.s = e
k.t = e
k.y = f
a.y = k
f.u = l
f.w = k
f.v = e
e.x = f
g.q = a
g.y = e
assert f.w.y.v.x.u.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.s: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.y: D = None
        self.txt = txt

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

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

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

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

l = A("l")
k = B("k")
a = C("a")
f = D("f")
e = E("e")
g = F("g")

l.u = a
l.s = e
k.t = e
k.y = f
a.y = k
f.u = l
f.w = k
f.v = e
e.x = f
g.q = a
g.y = e
assert f.w.y.v.x.u.s.txt == "e"