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

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

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

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

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

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

d = A("d")
m = B("m")
g = C("g")
l = D("l")
c = E("c")
a = F("a")

d.p = a
d.x = a
d.u = a
d.s = g
d.r = c
m.u = a
g.y = c
l.w = c
c.y = l
c.x = l
c.p = g
a.w = c
a.t = l
assert d.r.p.y.txt == "
class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.x: F = None
        self.s: C = None
        self.u: F = None
        self.r: E = None
        self.txt = txt

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

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

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

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

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

d = A("d")
m = B("m")
g = C("g")
l = D("l")
c = E("c")
a = F("a")

d.p = a
d.x = a
d.u = a
d.s = g
d.r = c
m.u = a
g.y = c
l.w = c
c.y = l
c.x = l
c.p = g
a.w = c
a.t = l
assert d.r.p.y.txt == "c"