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

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

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.q: E = None
        self.p: E = None
        self.o: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.r: F = None
        self.v: A = None
        self.txt = txt

f = A("f")
i = B("i")
c = C("c")
m = D("m")
a = E("a")
d = F("d")
l = F("l")
e = E("e")
h = C("h")
j = F("j")

f.s = c
f.o = c
f.x = c
i.p = f
i.q = m
i.x = e
c.w = i
c.q = e
c.p = a
c.o = m
m.q = i
a.u = e
d.r = l
d.v = f
l.r = d
l.v = f
e.u = a
h.w = i
h.q = a
h.p = e
h.o = m
j.r = l
j.v = f
assert h.o.q.p.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.o: C = None
        self.x: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.q: E = None
        self.p: E = None
        self.o: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.r: F = None
        self.v: A = None
        self.txt = txt

f = A("f")
i = B("i")
c = C("c")
m = D("m")
a = E("a")
d = F("d")
l = F("l")
e = E("e")
h = C("h")
j = F("j")

f.s = c
f.o = c
f.x = c
i.p = f
i.q = m
i.x = e
c.w = i
c.q = e
c.p = a
c.o = m
m.q = i
a.u = e
d.r = l
d.v = f
l.r = d
l.v = f
e.u = a
h.w = i
h.q = a
h.p = e
h.o = m
j.r = l
j.v = f
assert h.o.q.p.txt == "f"