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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

f = A("f")
j = B("j")
b = C("b")
d = D("d")
a = E("a")
i = F("i")
n = C("n")

f.s = a
f.w = n
f.y = b
j.r = n
b.u = a
b.y = n
b.v = i
d.x = n
a.s = i
a.q = n
a.r = n
a.x = f
a.u = d
i.q = j
n.u = a
n.y = b
n.v = i
assert f.w.y.u.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.s: E = None
        self.w: C = None
        self.y: C = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

f = A("f")
j = B("j")
b = C("b")
d = D("d")
a = E("a")
i = F("i")
n = C("n")

f.s = a
f.w = n
f.y = b
j.r = n
b.u = a
b.y = n
b.v = i
d.x = n
a.s = i
a.q = n
a.r = n
a.x = f
a.u = d
i.q = j
n.u = a
n.y = b
n.v = i
assert f.w.y.u.q.y.txt == "b"