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

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

class C:
    def __init__(self, txt: str):
        self.w: C = None
        self.v: F = None
        self.o: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.v: D = None
        self.s: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

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

i.x = n
i.s = c
n.w = a
n.q = i
j.w = f
j.v = d
j.o = c
c.u = f
g.p = n
g.v = c
g.s = f
a.p = c
e.x = n
e.s = c
d.p = c
f.w = j
f.v = a
f.o = c
assert f.v.p.u.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.s: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: C = None
        self.v: F = None
        self.o: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.v: D = None
        self.s: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

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

i.x = n
i.s = c
n.w = a
n.q = i
j.w = f
j.v = d
j.o = c
c.u = f
g.p = n
g.v = c
g.s = f
a.p = c
e.x = n
e.s = c
d.p = c
f.w = j
f.v = a
f.o = c
assert f.v.p.u.txt == "f"