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

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

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

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

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

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

e = A("e")
a = B("a")
h = C("h")
g = D("g")
b = E("b")
d = F("d")
l = E("l")
f = D("f")
m = B("m")

e.p = d
e.r = d
e.s = d
e.q = f
a.u = g
a.x = d
a.q = d
a.r = m
h.x = l
h.t = e
h.r = f
g.p = a
g.o = e
g.w = f
b.q = l
d.w = f
d.x = a
l.q = b
f.p = m
f.o = e
f.w = g
m.u = g
m.x = d
m.q = d
m.r = a
assert f.w.p.u.txt == "
class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.r: F = None
        self.q: D = None
        self.s: F = None
        self.txt = txt

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

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

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

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

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

e = A("e")
a = B("a")
h = C("h")
g = D("g")
b = E("b")
d = F("d")
l = E("l")
f = D("f")
m = B("m")

e.p = d
e.r = d
e.s = d
e.q = f
a.u = g
a.x = d
a.q = d
a.r = m
h.x = l
h.t = e
h.r = f
g.p = a
g.o = e
g.w = f
b.q = l
d.w = f
d.x = a
l.q = b
f.p = m
f.o = e
f.w = g
m.u = g
m.x = d
m.q = d
m.r = a
assert f.w.p.u.txt == "g"